import java.util.Scanner;

public class Main2 {
    public static int fun(int n) {
        if (n == 1) {
            return 0;
        } else if (n == 2 || n == 3) {
            return 1;
        } else {
            int a = (int) (n / 3.0 + 0.5);
            int b = n - a - a;
            int x = Math.max(a, b);
            return fun(x) + 1;
        }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        while (scanner.hasNextInt()) {
            int n = scanner.nextInt();
            if (n == 0) break;
            System.out.println(fun(n));
        }
    }
}
